主题
打开视频文件 - OpenVideo
函数简介
打开视频文件,返回视频句柄,支持本地文件和网络流。
接口名称
OpenVideoDLL调用
c
int64_t OpenVideo(int64_t instance, string videoPath);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| videoPath | 字符串 | 视频文件路径(支持本地文件和网络流URL) |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long video = ola.OpenVideo("videos/demo.mp4");csharp
using OLAPlug;
var ola = new OLAPlugServer();
long video = ola.OpenVideo("videos/demo.mp4");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
video = ola.OpenVideo("videos/demo.mp4")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
long video = ola.OpenVideo("videos/demo.mp4");cpp
var ola = com("OlaPlug.OlaSoft")
var video = ola.OpenVideo("videos/demo.mp4")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
video = ola.OpenVideo("videos/demo.mp4")text
.局部变量 ola, OLAPlug
ola.创建 ()
video = ola.OpenVideo(“videos/demo.mp4“)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var video = ola.OpenVideo("videos/demo.mp4");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 video = ola.OpenVideo("videos/demo.mp4")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long video = ola.OpenVideo("videos/demo.mp4");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long video = OpenVideo(instance, "videos/demo.mp4");csharp
long instance = CreateCOLAPlugInterFace();
long video = OpenVideo(instance, "videos/demo.mp4");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
video = OpenVideo(instance, "videos/demo.mp4")返回值
长整数型:视频句柄,失败返回 0。
注意事项
- 返回的句柄用于后续的视频操作,使用完毕后需调用 CloseVideo 释放
- 网络流需要稳定的网络连接
